package com.dgcsxy.cat_eyes_movies.controller;

import com.dgcsxy.cat_eyes_movies.common.utils.ResponseResult;
import com.dgcsxy.cat_eyes_movies.entity.dto.UserDto;
import com.dgcsxy.cat_eyes_movies.entity.pojo.User;
import com.dgcsxy.cat_eyes_movies.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author rokies
 * @DATE 2022/6/16 16:40
 * @Version 1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {


    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @PostMapping("/login")
    public ResponseResult userLogin(@RequestBody User user){
        return userService.userLogin(user);
    }

    @PostMapping("/register")
    public ResponseResult userRegister(@RequestBody UserDto userDto){
        return userService.userRegister(userDto);
    }

    @PostMapping("/update")
    public ResponseResult userUpdate(@RequestBody User user){
        return userService.userUpdate(user);
    }

}
